Test-Series - programming logic

Test Number 13/15

Q: Which term describes the mechanism of a function calling itself ?
A. polymorphism
B. encapsulation
C. Inheritance
D. recursion
Solution: The correct answer is:
recursion
Q: Array which is having ____ dimensions is called as 2-D array.
A. 5
B. 4
C. 2
D. 3
Solution: The correct answer is:
2
Q: Which is the correct sequence statements that swaps values of two statements?
A. None of these
B. a=a+b; a=a-b; b=a-b;
C. a=a+b, b=a-b; a=a-b;
D. a=a-b; a=a+b; b=b-a;
Solution: The correct answer is:
a=a+b, b=a-b; a=a-b;
Q: In many programming languages, ‘otherwise’ and ‘else’ are part of which building block?
A. Selection
B. Counter
C. Loop
D. List structure
Solution: The correct answer is:
Selection
Q: By default a real number is treated as a
A. float
B. double
C. integer
D. long double
Solution: The correct answer is:
float
Q: Choose the option that contains only Unary operators of C:
A. sizeof, (type conversion)
B. ==, !=
C. increment(++), >=, !
D. short hand operator, &
Solution: The correct answer is:
sizeof, (type conversion)
Q: What is the output of the following code segment(assuming sizeof(int) returns 4)?

int i=0x1 << sizeof(int)*8-1;
	printf("
%x",i);
	i=i>>sizeof(int)*8-1;
	printf("%d",i);
A. 0x8000000-1
B.  -1 0000000
C. 80000000-1
D. -1 0x0000000
Solution: The correct answer is:
80000000-1
Q:  Given two literals 0x001B and 033. What are these equal to?
A. 27 and 33
B. 33 and 33
C. 21 and 23
D. 27 and 27
Solution: The correct answer is:
27 and 27
Q: A robust program has which one of the following features?
A. It can handle incorrect input data or data types.
B. It runs correctly on some inputs
C.  It is robust to hardware damage
D. None of these
Solution: The correct answer is:
It can handle incorrect input data or data types.
Q: If we have declared an array described below -



int arr[6];
then which of the following array element is considered as last array element ?
A. arr[6]
B. arr[0]
C. arr[5]
D. arr[4]
Solution: The correct answer is:
arr[5]

You Have Score    /10